<%@page import="com.gxwz.medical.domain.Payment"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/base.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="css/admin.css">
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/admin.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		//重新绑定表单提交
		$("#query_btn").bind("click", function() {
			$('form').submit();
		});
	});
	//选择不同的村组
	function chooseGroup(){
		var val=$("#village").val();
		$.ajax({
			   type: "POST",
			   url: "<%=path%>/system/AreaServlet?m=groupList",
			   data: {"villageID":val},
			   dataType:"json",
			   success: function(data){
				 $("#group").empty();
			     $.each(data,function(i,val){
			    	 $("#group").append("<option value='"+val.areacode+"'>"+val.areaname+"</option>");
			     });
			   }
			});
	}
	</script>
  </head>
  
  <body>
  	<form method="post" action="<%=path %>/system/PaymentServlet?m=choose" id="listform">
    <div class="panel admin-panel">
    <div class="panel-head">
				<strong class="icon-reorder">参合缴费登记</strong>
			</div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left:10px;">
					<li><a class="button border-main icon-plus-square-o"
						href="<%=path%>/system/PaymentServlet?m=adds"> 添加</a></li>
				<li>所在村：</li>
				<li><select id="village" name="village" class="input" style="width:100px; line-height:17px;display:inline-block" 
							onchange="chooseGroup();">
							<c:forEach  items="${villages}" var="item">
							 <option value="${item.areacode}">${item.areaname}</option>
							</c:forEach>
						</select></li>
				    <li><label>所在组：</label>
				       </li>
				       <li><select id="group" name="group" class="input" style="width:100px; line-height:17px;display:inline-block"  >
								<option value="">请选择所在组</option>
							</select></li>
					<li><label>户主姓名：</label></li>
					<li><input type="text" placeholder="请输入搜索关键字" name="persname" data-validate="required:姓名不能为空" 
						class="input"
						style="width:150px; line-height:17px;display:inline-block" /> <a
						id="query_btn"
						href="javascript:void(0)" class="button border-main icon-search"
						> 查询</a></li>
				</ul>
			</div>
			<table class="table table-hover text-center">
				<tr>	<th width="50">序号</th>
					<th width="50" style="text-align:center;">&nbsp;</th>
					<th>参合证号</th>
					<th>参合发票号</th>
					<th>缴费金额</th>
					<th>缴费年度</th>
					<th>缴费时间</th>
					<th>操作员</th>
					<th>操作</th>
				</tr>
				<%
					String pageNo = request.getParameter("pageNo");
					int p = pageNo == null ? 1 : Integer.parseInt(pageNo);
					PaymentDao dao = new PaymentDao();
					String sql = "select * from t_payment where 1=1 ";
					Object[] params = {};
					Page pageBean = dao.queryOjectsByPage(sql, params, p,
							Constant.ROW);
				%>
					<%
					for (int i = 0; i < pageBean.getDatas().size(); i++) {

						Payment  model= (Payment) pageBean.getDatas().get(i);
						
				%>
				<tr>
				<td><%=(i+1) %></td>
					<td><input type="checkbox" name="ids"
						value="<%=model.getPayNo()%>" /></td>
					<td align="center"><%=model.getPayNo()%></td>
					<td><%=model.getPerscode() %></td>
					<td><%=model.getPayCost() %></td>
					<td><%=model.getPaytime() %></td>
					<td><%=model.getRunyear() %></td>
					<td><%=model.getCreator() %></td>
					<td><div class="button-group">
							<a class="button border-main"
								href="<%=path%>/system/PaymentServlet?m=get&id=<%=model.getPayNo()%>"><span
								class="icon-edit"></span> 修改</a> <a class="button border-red"
								href="<%=path%>/system/PaymentServlet?m=del&id=<%=model.getPayNo()%>"><span
								class="icon-trash-o"></span>取消参合</a>
						</div></td>
				</tr>
			
				<%
					}
				%>
			</table>
			<div class="pagelist">
				<%
					if (pageBean.hasPre()) {
				%>
				<a
					href="<%=path%>/system/PaymentServlet?m=list&pageNo=<%=pageBean.prePage()%>">上一页</a>
				<%
					} else {
				%>
				<a href="javascript:void(0)">上一页</a>
				<%
					}
				%>
				<%
					List<Integer> linkNums = pageBean.linkLumbers();
					for (int num : linkNums) {
					if (pageBean.isCurrent(num)) {
				%>
				<span class="current"><%=num%></span>
				<%
					} else {
				%>
				<a href="<%=path%>/system/PaymentServlet?m=list&pageNo=<%=num%>"><%=num%></a>
				<%
					}
					}
				%>
				<%
					if (pageBean.hasNext()) {
				%>
				<a
					href="<%=path%>/system/PaymentServlet?m=list&pageNo=<%=pageBean.lastPage()%>">下一页</a>
				<%
					} else {
				%>
				<a href="javascript:void(0)">下一页</a>
				<%
					}
				%>
				<a
					href="<%=path%>/system/PaymentServlet?m=list&pageNo=<%=pageBean.getPages()%>">尾页</a>
			</div>
		</div>
	</form>
  </body>
</html>
